@@ -0,0 +1,29 @@ |
||
1 |
+# EditorConfig is awesome: http://EditorConfig.org |
|
2 |
+ |
|
3 |
+# top-most EditorConfig file |
|
4 |
+root = true |
|
5 |
+ |
|
6 |
+# Unix-style newlines with a newline ending every file |
|
7 |
+[*] |
|
8 |
+end_of_line = lf |
|
9 |
+insert_final_newline = false |
|
10 |
+ |
|
11 |
+# 4 space indentation |
|
12 |
+[*.py] |
|
13 |
+indent_style = space |
|
14 |
+indent_size = 4 |
|
15 |
+ |
|
16 |
+# Tab indentation (no size specified) |
|
17 |
+[*.js] |
|
18 |
+indent_style = space |
|
19 |
+indent_size = 4 |
|
20 |
+ |
|
21 |
+# Tab indentation (no size specified) |
|
22 |
+[*.html] |
|
23 |
+indent_style = space |
|
24 |
+indent_size = 4 |
|
25 |
+ |
|
26 |
+# Matches the exact files either package.json or .travis.yml |
|
27 |
+[{package.json,.travis.yml}] |
|
28 |
+indent_style = space |
|
29 |
+indent_size = 2 |
@@ -0,0 +1,66 @@ |
||
1 |
+# Byte-compiled / optimized / DLL files |
|
2 |
+__pycache__/ |
|
3 |
+*.py[cod] |
|
4 |
+*.swp |
|
5 |
+# C extensions |
|
6 |
+*.so |
|
7 |
+ |
|
8 |
+# Distribution / packaging |
|
9 |
+bin/ |
|
10 |
+build/ |
|
11 |
+develop-eggs/ |
|
12 |
+dist/ |
|
13 |
+eggs/ |
|
14 |
+lib/ |
|
15 |
+lib64/ |
|
16 |
+parts/ |
|
17 |
+sdist/ |
|
18 |
+venv/ |
|
19 |
+var/ |
|
20 |
+static/upload/ |
|
21 |
+*.egg-info/ |
|
22 |
+.installed.cfg |
|
23 |
+*.egg |
|
24 |
+*.sublime* |
|
25 |
+ |
|
26 |
+# Installer logs |
|
27 |
+pip-log.txt |
|
28 |
+pip-delete-this-directory.txt |
|
29 |
+ |
|
30 |
+# Unit test / coverage reports |
|
31 |
+.tox/ |
|
32 |
+.coverage |
|
33 |
+.cache |
|
34 |
+nosetests.xml |
|
35 |
+coverage.xml |
|
36 |
+ |
|
37 |
+# Translations |
|
38 |
+# *.mo |
|
39 |
+ |
|
40 |
+# Mr Developer |
|
41 |
+.mr.developer.cfg |
|
42 |
+.project |
|
43 |
+.pydevproject |
|
44 |
+.settings |
|
45 |
+# Rope |
|
46 |
+.ropeproject |
|
47 |
+ |
|
48 |
+# Django stuff: |
|
49 |
+*.log |
|
50 |
+*.pot |
|
51 |
+ |
|
52 |
+# Sphinx documentation |
|
53 |
+docs/_build/ |
|
54 |
+ |
|
55 |
+ |
|
56 |
+# Ignore For zhTimer |
|
57 |
+.DS_Store |
|
58 |
+db.sqlite3 |
|
59 |
+local_settings.py |
|
60 |
+ |
|
61 |
+.idea/ |
|
62 |
+media/ |
|
63 |
+collect_static/ |
|
64 |
+ |
|
65 |
+# Special File |
|
66 |
+*download.html |
@@ -0,0 +1,8 @@ |
||
1 |
+# See the menu of settings available here: |
|
2 |
+# https://github.com/timothycrosley/isort/wiki/isort-Settings |
|
3 |
+ |
|
4 |
+[settings] |
|
5 |
+indent=' ' |
|
6 |
+line_length=120 |
|
7 |
+lines_after_imports=2 |
|
8 |
+skip=migrations |
@@ -0,0 +1,9 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+echo '>> iSort' |
|
4 |
+./isort.sh |
|
5 |
+echo |
|
6 |
+ |
|
7 |
+echo '>> PEP8' |
|
8 |
+./pep8.sh |
|
9 |
+echo |
@@ -0,0 +1,3 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+isort -rc -sp . . |
@@ -0,0 +1,23 @@ |
||
1 |
+#!/usr/bin/env python |
|
2 |
+import os |
|
3 |
+import sys |
|
4 |
+ |
|
5 |
+ |
|
6 |
+if __name__ == "__main__": |
|
7 |
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tamrondb.settings") |
|
8 |
+ try: |
|
9 |
+ from django.core.management import execute_from_command_line |
|
10 |
+ except ImportError: |
|
11 |
+ # The above import may fail for some other reason. Ensure that the |
|
12 |
+ # issue is really that Django is missing to avoid masking other |
|
13 |
+ # exceptions on Python 2. |
|
14 |
+ try: |
|
15 |
+ import django |
|
16 |
+ except ImportError: |
|
17 |
+ raise ImportError( |
|
18 |
+ "Couldn't import Django. Are you sure it's installed and " |
|
19 |
+ "available on your PYTHONPATH environment variable? Did you " |
|
20 |
+ "forget to activate a virtual environment?" |
|
21 |
+ ) |
|
22 |
+ raise |
|
23 |
+ execute_from_command_line(sys.argv) |
@@ -0,0 +1,9 @@ |
||
1 |
+#!/bin/bash |
|
2 |
+ |
|
3 |
+# Ignoring autogenerated files |
|
4 |
+# -- Migration directories |
|
5 |
+# Ignoring error codes |
|
6 |
+# -- E128 continuation line under-indented for visual indent |
|
7 |
+# -- E501 line too long |
|
8 |
+ |
|
9 |
+pycodestyle --exclude=migrations --ignore=E128,E501 . |
@@ -0,0 +1,37 @@ |
||
1 |
+-e git+https://github.com/Brightcells/django-q.git#egg=django-q |
|
2 |
+CodeConvert==2.0.4 |
|
3 |
+Django==1.8.4 |
|
4 |
+MySQL-python==1.2.5 |
|
5 |
+Pillow==4.3.0 |
|
6 |
+StatusCode==1.0.0 |
|
7 |
+TimeConvert==1.4.1 |
|
8 |
+cryptography==2.0.3 |
|
9 |
+django-curtail-uuid==1.0.0 |
|
10 |
+django-detect==1.0.5 |
|
11 |
+django-file-md5==1.0.1 |
|
12 |
+django-ip==1.0.2 |
|
13 |
+django-json-response==1.1.5 |
|
14 |
+django-logit==1.0.6 |
|
15 |
+django-multidomain==1.1.4 |
|
16 |
+django-paginator2==1.0.3 |
|
17 |
+django-rlog==1.0.7 |
|
18 |
+django-shortuuidfield==0.1.3 |
|
19 |
+django-six==1.0.4 |
|
20 |
+djangorestframework==3.7.3 |
|
21 |
+furl==1.0.1 |
|
22 |
+hiredis==0.2.0 |
|
23 |
+isoweek==1.3.3 |
|
24 |
+jsonfield==2.0.2 |
|
25 |
+mock==2.0.0 |
|
26 |
+pysnippets==1.0.4 |
|
27 |
+pywe-miniapp==1.0.0 |
|
28 |
+pywe-oauth==1.0.5 |
|
29 |
+pywe-response==1.0.1 |
|
30 |
+qiniu==7.1.9 |
|
31 |
+redis==2.10.6 |
|
32 |
+redis-extensions==1.1.5 |
|
33 |
+requests==2.18.4 |
|
34 |
+rlog==0.3 |
|
35 |
+shortuuid==0.5.0 |
|
36 |
+uWSGI==2.0.15 |
|
37 |
+versions==0.10.0 |
@@ -0,0 +1,14 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+ |
|
3 |
+from djadmin import ExportExcelModelAdmin, ReadonlyModelAdmin |
|
4 |
+from django.contrib import admin |
|
5 |
+ |
|
6 |
+from tamron.models import TamronSliderInfo |
|
7 |
+ |
|
8 |
+ |
|
9 |
+class TamronSliderInfoAdmin(admin.ModelAdmin): |
|
10 |
+ list_display = ('fid', 'pic', 'url', 'px') |
|
11 |
+ list_filter = ('fid', ) |
|
12 |
+ |
|
13 |
+ |
|
14 |
+admin.site.register(TamronSliderInfo, TamronSliderInfoAdmin) |
@@ -0,0 +1,8 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+from __future__ import unicode_literals |
|
3 |
+ |
|
4 |
+from django.apps import AppConfig |
|
5 |
+ |
|
6 |
+ |
|
7 |
+class TamronConfig(AppConfig): |
|
8 |
+ name = 'tamron' |
@@ -0,0 +1,28 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+ |
|
3 |
+from django.db import models |
|
4 |
+from django.utils.translation import ugettext_lazy as _ |
|
5 |
+from models_ext import upload_path |
|
6 |
+ |
|
7 |
+ |
|
8 |
+class TamronSliderInfo(models.Model): |
|
9 |
+ HOME = 1 |
|
10 |
+ PGIST = 2 |
|
11 |
+ |
|
12 |
+ SLIEDER_TYPE_TUPLE = ( |
|
13 |
+ (HOME, u'首页轮播图'), |
|
14 |
+ (PGIST, u'产品注册页轮播图'), |
|
15 |
+ ) |
|
16 |
+ |
|
17 |
+ fid = models.IntegerField(_(u'fid'), choices=SLIEDER_TYPE_TUPLE, default=HOME, help_text=u'轮播图类型') |
|
18 |
+ pic = models.FileField(_(u'pic'), upload_to=upload_path, blank=True, null=True, help_text=u'轮播图图片') |
|
19 |
+ url = models.CharField(_(u'url'), max_length=255, blank=True, null=True, help_text=u'轮播图链接') |
|
20 |
+ px = models.IntegerField(_(u'px'), default=1, help_text=u'???') |
|
21 |
+ |
|
22 |
+ class Meta: |
|
23 |
+ verbose_name = _(u'轮播图') |
|
24 |
+ verbose_name_plural = _(u'轮播图') |
|
25 |
+ db_table = 'shidu_banner' |
|
26 |
+ |
|
27 |
+ def __unicode__(self): |
|
28 |
+ return unicode(self.pk) |
@@ -0,0 +1,7 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+from __future__ import unicode_literals |
|
3 |
+ |
|
4 |
+from django.test import TestCase |
|
5 |
+ |
|
6 |
+ |
|
7 |
+# Create your tests here. |
@@ -0,0 +1,7 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+from __future__ import unicode_literals |
|
3 |
+ |
|
4 |
+from django.shortcuts import render |
|
5 |
+ |
|
6 |
+ |
|
7 |
+# Create your views here. |
@@ -0,0 +1,149 @@ |
||
1 |
+# -*- coding: utf-8 -*- |
|
2 |
+ |
|
3 |
+""" |
|
4 |
+Django settings for tamrondb project. |
|
5 |
+ |
|
6 |
+Generated by 'django-admin startproject' using Django 1.11.3. |
|
7 |
+ |
|
8 |
+For more information on this file, see |
|
9 |
+https://docs.djangoproject.com/en/1.11/topics/settings/ |
|
10 |
+ |
|
11 |
+For the full list of settings and their values, see |
|
12 |
+https://docs.djangoproject.com/en/1.11/ref/settings/ |
|
13 |
+""" |
|
14 |
+ |
|
15 |
+import os |
|
16 |
+ |
|
17 |
+ |
|
18 |
+# Build paths inside the project like this: os.path.join(BASE_DIR, ...) |
|
19 |
+BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
|
20 |
+PROJ_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__))) |
|
21 |
+ |
|
22 |
+ |
|
23 |
+# Quick-start development settings - unsuitable for production |
|
24 |
+# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/ |
|
25 |
+ |
|
26 |
+# SECURITY WARNING: keep the secret key used in production secret! |
|
27 |
+SECRET_KEY = '70^&x-7y*t1^osbm8c4-oy3vje+2&ph$j)n&)_q)j%7r%-fjy)' |
|
28 |
+ |
|
29 |
+# SECURITY WARNING: don't run with debug turned on in production! |
|
30 |
+DEBUG = True |
|
31 |
+ |
|
32 |
+ALLOWED_HOSTS = [] |
|
33 |
+ |
|
34 |
+ |
|
35 |
+# Application definition |
|
36 |
+ |
|
37 |
+INSTALLED_APPS = [ |
|
38 |
+ 'django.contrib.admin', |
|
39 |
+ 'django.contrib.auth', |
|
40 |
+ 'django.contrib.contenttypes', |
|
41 |
+ 'django.contrib.sessions', |
|
42 |
+ 'django.contrib.messages', |
|
43 |
+ 'django.contrib.staticfiles', |
|
44 |
+ 'tamron', |
|
45 |
+] |
|
46 |
+ |
|
47 |
+MIDDLEWARE = [ |
|
48 |
+ 'django.middleware.security.SecurityMiddleware', |
|
49 |
+ 'django.contrib.sessions.middleware.SessionMiddleware', |
|
50 |
+ 'django.middleware.common.CommonMiddleware', |
|
51 |
+ 'django.middleware.csrf.CsrfViewMiddleware', |
|
52 |
+ 'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
53 |
+ 'django.contrib.messages.middleware.MessageMiddleware', |
|
54 |
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|
55 |
+] |
|
56 |
+ |
|
57 |
+ROOT_URLCONF = 'tamrondb.urls' |
|
58 |
+ |
|
59 |
+TEMPLATES = [ |
|
60 |
+ { |
|
61 |
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates', |
|
62 |
+ 'DIRS': [], |
|
63 |
+ 'APP_DIRS': True, |
|
64 |
+ 'OPTIONS': { |
|
65 |
+ 'context_processors': [ |
|
66 |
+ 'django.template.context_processors.debug', |
|
67 |
+ 'django.template.context_processors.request', |
|
68 |
+ 'django.contrib.auth.context_processors.auth', |
|
69 |
+ 'django.contrib.messages.context_processors.messages', |
|
70 |
+ ], |
|
71 |
+ }, |
|
72 |
+ }, |
|
73 |
+] |
|
74 |
+ |
|
75 |
+WSGI_APPLICATION = 'tamrondb.wsgi.application' |
|
76 |
+ |
|
77 |
+ |
|
78 |
+# Database |
|
79 |
+# https://docs.djangoproject.com/en/1.11/ref/settings/#databases |
|
80 |
+ |
|
81 |
+DATABASES = { |
|
82 |
+ 'default': { |
|
83 |
+ 'ENGINE': 'django.db.backends.mysql', |
|
84 |
+ 'NAME': 'tenglong', |
|
85 |
+ 'USER': 'root', |
|
86 |
+ 'PASSWORD': '', |
|
87 |
+ 'HOST': '127.0.0.1', |
|
88 |
+ 'PORT': 3306, |
|
89 |
+ 'CONN_MAX_AGE': 600, |
|
90 |
+ 'OPTIONS': { |
|
91 |
+ 'charset': 'utf8mb4', |
|
92 |
+ }, |
|
93 |
+ } |
|
94 |
+} |
|
95 |
+ |
|
96 |
+ |
|
97 |
+# Password validation |
|
98 |
+# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators |
|
99 |
+ |
|
100 |
+AUTH_PASSWORD_VALIDATORS = [ |
|
101 |
+ { |
|
102 |
+ 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', |
|
103 |
+ }, |
|
104 |
+ { |
|
105 |
+ 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', |
|
106 |
+ }, |
|
107 |
+ { |
|
108 |
+ 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', |
|
109 |
+ }, |
|
110 |
+ { |
|
111 |
+ 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', |
|
112 |
+ }, |
|
113 |
+] |
|
114 |
+ |
|
115 |
+ |
|
116 |
+# Internationalization |
|
117 |
+# https://docs.djangoproject.com/en/1.11/topics/i18n/ |
|
118 |
+ |
|
119 |
+LANGUAGE_CODE = 'zh-Hans' |
|
120 |
+ |
|
121 |
+TIME_ZONE = 'Asia/Shanghai' |
|
122 |
+ |
|
123 |
+USE_I18N = True |
|
124 |
+ |
|
125 |
+USE_L10N = True |
|
126 |
+ |
|
127 |
+USE_TZ = True |
|
128 |
+ |
|
129 |
+ |
|
130 |
+# Static files (CSS, JavaScript, Images) |
|
131 |
+# https://docs.djangoproject.com/en/1.11/howto/static-files/ |
|
132 |
+ |
|
133 |
+STATICFILES_DIRS = ( |
|
134 |
+ os.path.join(PROJ_DIR, 'static').replace('\\', '/'), |
|
135 |
+) |
|
136 |
+ |
|
137 |
+STATIC_ROOT = os.path.join(BASE_DIR, 'collect_static').replace('\\', '/') |
|
138 |
+ |
|
139 |
+STATIC_URL = '/static/' |
|
140 |
+ |
|
141 |
+STATICFILES_FINDERS = ( |
|
142 |
+ 'django.contrib.staticfiles.finders.FileSystemFinder', |
|
143 |
+ 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
144 |
+ # 'django.contrib.staticfiles.finders.DefaultStorageFinder', |
|
145 |
+) |
|
146 |
+ |
|
147 |
+MEDIA_ROOT = os.path.join(BASE_DIR, 'media').replace('\\', '/') |
|
148 |
+ |
|
149 |
+MEDIA_URL = '/media/' |
@@ -0,0 +1,22 @@ |
||
1 |
+"""tamrondb URL Configuration |
|
2 |
+ |
|
3 |
+The `urlpatterns` list routes URLs to views. For more information please see: |
|
4 |
+ https://docs.djangoproject.com/en/1.11/topics/http/urls/ |
|
5 |
+Examples: |
|
6 |
+Function views |
|
7 |
+ 1. Add an import: from my_app import views |
|
8 |
+ 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') |
|
9 |
+Class-based views |
|
10 |
+ 1. Add an import: from other_app.views import Home |
|
11 |
+ 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') |
|
12 |
+Including another URLconf |
|
13 |
+ 1. Import the include() function: from django.conf.urls import url, include |
|
14 |
+ 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) |
|
15 |
+""" |
|
16 |
+from django.conf.urls import url |
|
17 |
+from django.contrib import admin |
|
18 |
+ |
|
19 |
+ |
|
20 |
+urlpatterns = [ |
|
21 |
+ url(r'^admin/', admin.site.urls), |
|
22 |
+] |
@@ -0,0 +1,17 @@ |
||
1 |
+""" |
|
2 |
+WSGI config for tamrondb project. |
|
3 |
+ |
|
4 |
+It exposes the WSGI callable as a module-level variable named ``application``. |
|
5 |
+ |
|
6 |
+For more information on this file, see |
|
7 |
+https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ |
|
8 |
+""" |
|
9 |
+ |
|
10 |
+import os |
|
11 |
+ |
|
12 |
+from django.core.wsgi import get_wsgi_application |
|
13 |
+ |
|
14 |
+ |
|
15 |
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tamrondb.settings") |
|
16 |
+ |
|
17 |
+application = get_wsgi_application() |